home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / ole / oledsrvr / client.frm next >
Text File  |  1996-01-04  |  3KB  |  124 lines

  1. VERSION 4.00
  2. Begin VB.Form frmClient 
  3.    Caption         =   "Get Next Item"
  4.    ClientHeight    =   1320
  5.    ClientLeft      =   585
  6.    ClientTop       =   930
  7.    ClientWidth     =   3300
  8.    Height          =   1725
  9.    Left            =   525
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   1320
  12.    ScaleWidth      =   3300
  13.    Top             =   585
  14.    Width           =   3420
  15.    Begin VB.TextBox Text1 
  16.       Height          =   855
  17.       Left            =   2010
  18.       MultiLine       =   -1  'True
  19.       TabIndex        =   3
  20.       Top             =   90
  21.       Width           =   1215
  22.    End
  23.    Begin VB.Timer Timer1 
  24.       Interval        =   1000
  25.       Left            =   210
  26.       Top             =   1125
  27.    End
  28.    Begin VB.CommandButton Command1 
  29.       Caption         =   "Request"
  30.       Height          =   450
  31.       Left            =   75
  32.       TabIndex        =   0
  33.       Top             =   75
  34.       Width           =   1830
  35.    End
  36.    Begin VB.Label Label2 
  37.       Alignment       =   1  'Right Justify
  38.       Caption         =   "time"
  39.       ForeColor       =   &H000000FF&
  40.       Height          =   225
  41.       Left            =   1140
  42.       TabIndex        =   2
  43.       Top             =   1080
  44.       Width           =   2100
  45.    End
  46.    Begin VB.Label Label1 
  47.       Caption         =   "Label1"
  48.       Height          =   360
  49.       Left            =   75
  50.       TabIndex        =   1
  51.       Top             =   615
  52.       Width           =   1845
  53.    End
  54. End
  55. Attribute VB_Name = "frmClient"
  56. Attribute VB_Creatable = False
  57. Attribute VB_Exposed = False
  58. Option Explicit
  59.  
  60. '-- Technique 'A': will instantiate on Form Load:
  61. Private objDataServer As ServerTest3.CDataServer
  62.  
  63. '-- Technique 'B': will instantiate on first Request
  64. '   (need to comment out 'Set objDataServer = New ServerTest3.CDataServer'
  65. '    in Form Load event).
  66. 'Private objDataServer As New ServerTest3.CDataServer
  67.  
  68. Private objRequest As New CRequest
  69. Public mstrProgID As String
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. Public Function Request() As Boolean
  77.  
  78.  
  79. On Error Resume Next
  80. objDataServer.RegisterRequest objRequest
  81. If Err Then
  82.   Label1 = "Error: " & Err.Description
  83.   On Error GoTo 0
  84.   Request = False
  85. Else
  86.   Request = True
  87.   Label1 = "Request in process"
  88. End If
  89.  
  90. End Function
  91.  
  92. Private Sub Command1_Click()
  93.  
  94. Request
  95. Text1.SetFocus
  96.  
  97. End Sub
  98.  
  99.  
  100. Private Sub Form_Load()
  101.  
  102. '----- comment out next line when using 'Technique B' for
  103. '      instantiating classes - see Declarations section.
  104. Set objDataServer = New ServerTest3.CDataServer
  105.  
  106.  
  107. mstrProgID = Format(Now, "hhmmss")
  108. Me.Caption = "OLE Client: " & mstrProgID
  109.  
  110. End Sub
  111.  
  112.  
  113. Private Sub Form_Unload(Cancel As Integer)
  114. Set objDataServer = Nothing
  115. Set objRequest = Nothing
  116. End Sub
  117.  
  118.  
  119. Private Sub Timer1_Timer()
  120. Label2 = Time
  121. End Sub
  122.  
  123.  
  124.